coin = "jx压岁钱.png"
--[[img = image.snapshot()
if img~= nil then
    img1 = image.crop(img,95,492,193,522)
    mSleep(1000)
    if img1~= nil then
        image.save(img1,coin)
        mSleep(1000)
    else
        toast("img1 裁剪 nil")
        mSleep(3000)
    end
else
    toast("img 截图 nil")
    mSleep(3000)
end--]]

while true do
    wid= widget.find({["text"]="京喜发福利啦！"})
    if  wid  then
        x,y = image.findImageInRegion(coin,25,213,1062,2176,90)
        if x~=-1 and x~=-1 then
            event.tap(x+120,y+135)
                mSleep(2000) 
            toast("去完成然后等待 8 秒") 
            mSleep(6*1000)
            --wid= widget.find({["text"]="京喜发福利啦！"})
            --if  wid == nil  then
                keycode.back()
                toast("返回") 
                mSleep(3000) 
            --end
        end
    end
end